using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class locales_points_of_interest : MangosBase
	{
		public System.UInt32? entry;
		public System.String icon_name_loc1;
		public System.String icon_name_loc2;
		public System.String icon_name_loc3;
		public System.String icon_name_loc4;
		public System.String icon_name_loc5;
		public System.String icon_name_loc6;
		public System.String icon_name_loc7;
		public System.String icon_name_loc8;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `locales_points_of_interest` (`entry`, `icon_name_loc1`, `icon_name_loc2`, `icon_name_loc3`, `icon_name_loc4`, `icon_name_loc5`, `icon_name_loc6`, `icon_name_loc7`, `icon_name_loc8`) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}');", entry.GetValueOrDefault(), icon_name_loc1.MySQLDBString(), icon_name_loc2.MySQLDBString(), icon_name_loc3.MySQLDBString(), icon_name_loc4.MySQLDBString(), icon_name_loc5.MySQLDBString(), icon_name_loc6.MySQLDBString(), icon_name_loc7.MySQLDBString(), icon_name_loc8.MySQLDBString());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `locales_points_of_interest` SET ");
			if(icon_name_loc1 != null)
			{
				sb.AppendLine("`icon_name_loc1`='" + icon_name_loc1.MySQLDBString() + "'");
			}
			if(icon_name_loc2 != null)
			{
				sb.AppendLine("`icon_name_loc2`='" + icon_name_loc2.MySQLDBString() + "'");
			}
			if(icon_name_loc3 != null)
			{
				sb.AppendLine("`icon_name_loc3`='" + icon_name_loc3.MySQLDBString() + "'");
			}
			if(icon_name_loc4 != null)
			{
				sb.AppendLine("`icon_name_loc4`='" + icon_name_loc4.MySQLDBString() + "'");
			}
			if(icon_name_loc5 != null)
			{
				sb.AppendLine("`icon_name_loc5`='" + icon_name_loc5.MySQLDBString() + "'");
			}
			if(icon_name_loc6 != null)
			{
				sb.AppendLine("`icon_name_loc6`='" + icon_name_loc6.MySQLDBString() + "'");
			}
			if(icon_name_loc7 != null)
			{
				sb.AppendLine("`icon_name_loc7`='" + icon_name_loc7.MySQLDBString() + "'");
			}
			if(icon_name_loc8 != null)
			{
				sb.AppendLine("`icon_name_loc8`='" + icon_name_loc8.MySQLDBString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
				sb.Append(" WHERE `entry`='" + entry.Value.ToString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
